unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  I: integer;
  bit1, bit2: TBitmap;
  ID: DWORD;
  w,h: Integer;

implementation

{$R *.dfm}

function DrawBWProc():Integer;
var
  x,y: Integer;
begin
  w:= GetSystemMetrics(SM_CXSCREEN);
  h:= GetSystemMetrics(SM_CYSCREEN);
  bit1.Height := h;
  bit1.Width := w;
  for y:=0 to h do
    for x:=0 to w do begin
      if y mod 2 = 0 then begin
        if x mod 2 =0 then begin
          bit1.Canvas.Lock;
          bit1.Canvas.Pixels[x,y] := clBlack;
          bit1.Canvas.UnLock;
        end
        else begin
          bit1.Canvas.Lock;
          bit1.Canvas.Pixels[x,y] := clWhite;
          bit1.Canvas.UnLock;
        end;
      end
      else begin
        if x mod 2 =0 then begin
          bit1.Canvas.Lock;
          bit1.Canvas.Pixels[x,y] := clWhite;
          bit1.Canvas.UnLock;
        end
        else begin
          bit1.Canvas.Lock;
          bit1.Canvas.Pixels[x,y] := clBlack;
          bit1.Canvas.UnLock;
        end;
      end;
    end;
  Result :=0;
end;

function DrawPurpleProc():Integer;
var
  x,y: Integer;
begin
  w:= GetSystemMetrics(SM_CXSCREEN);
  h:= GetSystemMetrics(SM_CYSCREEN);
  bit2.Height := h;
  bit2.Width := w;
  for y:=0 to h do
    for x:=0 to w do begin
      if y mod 2 = 0 then begin
        if x mod 2 =0 then begin
          bit2.Canvas.Lock;
          bit2.Canvas.Pixels[x,y] := clPurple;
          bit2.Canvas.UnLock;
        end
        else begin
          bit2.Canvas.Lock;
          bit2.Canvas.Pixels[x,y] := clBlack;
          bit2.Canvas.UnLock;
        end;
      end
      else begin
        if x mod 2 =0 then begin
          bit2.Canvas.Lock;
          bit2.Canvas.Pixels[x,y] := clBlack;
          bit2.Canvas.UnLock;
        end
        else begin
          bit2.Canvas.Lock;
          bit2.Canvas.Pixels[x,y] := clPurple;
          bit2.Canvas.UnLock;
        end;
      end;
    end;
  Result :=0;
end;

procedure TForm1.FormClick(Sender: TObject);
begin
  inc(i);
  Button1.Visible := false;
case i of
  1: form1.Color := clRed;
  2: form1.Color := clGreen;
  3: form1.Color := clBlue;
  4: form1.Color := clWhite;
  5: form1.Color := clSilver;
  6: form1.Color := clMedGray;
  7: form1.Color := clGray;
  8: Form1.Canvas.Draw(0,0,bit2);
  9: Form1.Canvas.Draw(0,0,bit1);
  10: form1.Color := clBlack;
end;

  if i >= 10 then begin
     i := 0;
     Button1.Visible := true;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  i:=0;
  form1.Color := clWhite;

  bit1 := TBitmap.Create;
  bit2 := TBitmap.Create;

  CreateThread(nil, 0, @DrawBWProc, nil, 0, ID);
  CreateThread(nil, 0, @DrawPurpleProc, nil, 0, ID);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  close;
end;

end.
